--- import AuthorCard from '@/components/AuthorCard.astro' import BlogCard from '@/components/BlogCard.astro' import Breadcrumbs from '@/components/Breadcrumbs.astro' import Container from '@/components/Container.astro' import Layout from '@/layouts/Layout.astro' import { type CollectionEntry, getCollection } from 'astro:content' export async function getStaticPaths() { const authors = await getCollection('authors') return authors.map((author) => ({ params: { slug: author.slug }, props: { author }, })) } type Props = { author: CollectionEntry<'authors'> } const { author } = Astro.props const allPosts = await getCollection('blog') const authorPosts = allPosts .filter((post) => { return post.data.authors && post.data.authors.includes(author.slug) }) .sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf()) ---

Posts by {author.data.name}

{ authorPosts.length > 0 ? (
    {authorPosts.map((post) => (
  • ))}
) : (

No posts available from this author.

) }